CXXFLAGS=-Igenerated -Iinclude
#LDLIBS=-lIce -lGlacier2 -lIceGrid -lIceSSL `Magick++-config --cppflags --cxxflags --ldflags --libs`
SLICE=slice2cpp

all: libSessionManagerServiceI.so libYafridngNodeServiceI.so YafridngClientUI YafridngProvider PermissionsVerifierServer


libSessionManagerServiceI.so: generated/Yafridng.o  SessionManagerI.o SessionManagerServiceI.cpp
	gcc -fPIC -shared -o $@ -Igenerated -Iinclude -Wl,-soname,libSessionManagerServiceI.so.33 $^ -lIce -lIceGrid -lIceBox
	/sbin/ldconfig -vn .

libYafridngNodeServiceI.so: generated/Yafridng.o YafridngNodeManagerI.o YafridngNodeServiceI.cpp
	gcc -fPIC -shared -o $@ -Igenerated -Iinclude -Wl,-soname,libYafridngNodeService.so.33 $^ -lIce -lIceGrid -lIceBox
	/sbin/ldconfig -vn .

YafridngClient: LDLIBS=-lIce -lGlacier2 -lIceGrid -lIceSSL `Magick++-config --cppflags --cxxflags --ldflags --libs`
YafridngClient: YafridngClient.cpp YafridngRenderManagerI.o FileStoreI.o FileI.o FileManager.o P2PBrokerI.o ResultManager.o generated/Yafridng.o

YafridngClientUI: CXXFLAGS=-Igenerated -Iinclude `pkg-config --cflags gtkmm-2.4 libglademm-2.4`
YafridngClientUI: LDLIBS=-lIce -lGlacier2 -lIceGrid -lIceSSL `Magick++-config --cppflags --cxxflags --ldflags --libs` `pkg-config --libs gtkmm-2.4 libglademm-2.4`
YafridngClientUI: YafridngClientUI.cpp ClientThread.o Controller.o YafridngInterface.o YafridngRenderManagerI.o FileStoreI.o FileI.o FileManager.o P2PBrokerI.o ResultManager.o generated/Yafridng.o

YafridngProvider: CXXFLAGS=-Igenerated -Iinclude
YafridngProvider: LDLIBS=-lIce -lGlacier2 -lIceGrid -lIceSSL
YafridngProvider: generated/Yafridng.o YafridngRendererFactoryI.o YafridngRendererI.o FileStoreI.o FileI.o FileManager.o YafridngProvider.cpp

PermissionsVerifierServer: LDLIBS=-lIce -lGlacier2 -lIceGrid -lIceSSL
PermissionsVerifierServer: PermissionsVerifierServer.cpp

generated/Yafridng.o: generated/Yafridng.cpp

generated/Yafridng.cpp: slice/Yafridng.ice
	slice2cpp -I /usr/share/slice --output-dir ./generated $<

yafridng:
	make; cp YafridngClientUI ../client; cp ./ui/yafridng.glade ../client/ui/; cp PermissionsVerifierServer ../Verifier;
clean:
	$(RM) *.o *~ ./YafridngConfig ./YafridngClientUI *.so* ./PermissionsVerifierServer ./generated/*
